package net.kleinhenz.questor.model;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Fighter extends VariableContainer
{
	private List<Item> items = new ArrayList<Item>();
	private List<Skill> skills = new ArrayList<Skill>();
		
	public List<Item> getItems()
	{
		return items;
	}
	
	public void addItem(Item item)
	{
		getItems().add(item);
	}
	
	public void removeItem(Item item)
	{
		getItems().remove(item);
	}

	public List<Item> getItems(String type)
	{
		List<Item> result = new ArrayList<Item>();
		Iterator<Item> iter = getItems().iterator();
		while (iter.hasNext())
		{
			Item thisItem = iter.next();
			if (thisItem.getType()==type)
				result.add(thisItem);
		}
		return result;		
	}

	public List<Skill> getSkills()
	{
		return skills;
	}
	
	public void addSkill(Skill skill)
	{
		getSkills().add(skill);
	}
	
	public void removeSkill(Skill skill)
	{
		getSkills().remove(skill);
	}

	public List<Skill> getSkills(String type)
	{
		List<Skill> result = new ArrayList<Skill>();
		Iterator<Skill> iter = getSkills().iterator();
		while (iter.hasNext())
		{
			Skill thisSkill = iter.next();
			if (thisSkill.getType()==type)
				result.add(thisSkill);
		}
		return result;		
	}
}
